package com.session03;

public class Polygon {
    //全局变量
    public int sides;//多边形的边数
    public double area;//多边形的面积

    public Polygon(int sides) {
        this.sides = sides;
        System.out.println("在Polygon类的构造器中");
    }

    public int getNumberOfSides() {
        System.out.println("边数为" + this.sides);
        return this.sides;
    }

    @Override
    public String toString() {
        return "多边形的边数为" + this.sides;
    }
}
